package com.harmontronics.hanma.paas.paas.domain.releasesetup.repository.persistence;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.harmontronics.hanma.paas.paas.consts.EnvEnum;
import com.harmontronics.hanma.paas.paas.domain.releasesetup.entity.valueobject.HmReleaseRecordFields;
import com.harmontronics.hanma.paas.paas.domain.releasesetup.repository.mapper.HmReleaseRecordMapper;
import com.harmontronics.hanma.paas.paas.domain.releasesetup.repository.po.HmReleaseRecordPO;
import org.springframework.stereotype.Repository;


/**
 * @author ldb
 */
@Repository("hmReleaseRecordRepository")
public class HmReleaseRecordRepository extends ServiceImpl<HmReleaseRecordMapper, HmReleaseRecordPO> {

    public IPage<HmReleaseRecordPO> selectPage(QueryWrapper<HmReleaseRecordPO> queryWrapper, Page<HmReleaseRecordPO> page) {
        return baseMapper.selectPage(page, queryWrapper);
    }


    public List<HmReleaseRecordPO> findByAppUniqueId(String uniqueId){
        QueryWrapper<HmReleaseRecordPO> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq(HmReleaseRecordFields.APP_UNIQUE_ID,uniqueId);
        return baseMapper.selectList(queryWrapper);
    }
    public List<HmReleaseRecordPO> findByAppUniqueIdAndSetupType(String uniqueId, EnvEnum setupType){
        QueryWrapper<HmReleaseRecordPO> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq(HmReleaseRecordFields.APP_UNIQUE_ID,uniqueId);
        queryWrapper.eq(HmReleaseRecordFields.SETUP_TYPE,setupType);
        return baseMapper.selectList(queryWrapper);
    }
}